﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetTemplet.aspx.cs" Inherits="PlugNT.Cms.Web.Admin.Pre_Systems.SetTemplet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>切换模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/control.css" rel="stylesheet" type="text/css" media="all" />
<link href="../css/jquery/ui-1.8.18.custom.css" rel="stylesheet" type="text/css" media="all" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        var tmpdir = "<%=PlugNT.Cms.Custom.WebConfig.TempletDir %>";
        $("#tmpul li").each(function () {
            if ($(this).attr("title") == tmpdir) {
                $(this).attr("class", "sel");
            }
        });
        $("#tmpul li").click(function () {
            if ($(this).attr("title") != tmpdir) {
                if (startWith($(this).attr("title"), "old_")) {
                    alert("不能切换弃用模板！");
                } else {
                    OpenDialog('切换模板', 'SetTempletPrompt.aspx?tmp=' + $(this).attr("title"));
                }
            } else {
                alert("不能切换当前模板！");
            }
        });
        $("#tmpul li").hover(function () {
            $(this).attr("class", "sel");
        }, function () {
            if ($(this).attr("title") == tmpdir) {
                $(this).attr("class", "sel");
            }
            else {
                $(this).attr("class", "uns");
            }
        });
    });
    function closeFrm() {
        $("#dialogFrame").dialog("close");
        document.location.reload();
    }
    function OpenDialog(txt, url) {
        $("#dialogFrame").remove();
        var str = "<div id='dialogFrame'><iframe src='" + url + "' frameborder='0' marginwidth='0' marginheight='0' width='335' height='160'></iframe></div>";
        $("body").append(str);
        $("#dialogFrame").dialog({
            title: txt,
            autoOpen: true,
            modal: true,
            width: 350,
            height: 200,
            resizable: true,
            bgiframe: true
        });
    }
    function endWith(str, sta) {
        if (str == null || str == "" || str.length == 0 || sta.length > str.length) {
            return false;
        }
        if (str.substring(str.length - sta.length) == str) {
            return true;
        } else {
            return false;
        }
    }
    function startWith(str, sta) {
        if (str == null || str == "" || str.length == 0 || sta.length > str.length) {
            return false;
        }
        if (str.substr(0, sta.length) == sta) {
            return true;
        }
        else {
            return false;
        }
    }
</script>
</head>
<body>

<div class="frmstatic" style="display:block">
    <span class="frmbar" style="margin:0 12px;"></span><span class="frmbar" style="margin:0 11px;"></span>
    <div class="nav_menu">
        <table cellspacing="0" cellpadding="0" border="0" width="100%">
          <tr>
            <td align="left">
                <table>
                    <tr>
                        <td><img src="../images/main_home.gif" width="16" height="16" /></td>
                        <td><label>设置&nbsp;&gt;&nbsp;模板管理&nbsp;&gt;&nbsp;选择模板</label></td>
                    </tr>
                </table>
            </td>
            <td align="right">
                <table>
                    <tr>
                        <td><img src="../images/arrow_left.png" width="16" height="16" /></td>
                        <td><label><a href="./FckTemplets.aspx">编辑器模板</a></label> | </td>
                        <td><label><a href="javascript:window.history.back();" class="sub_menu">返回</a></label></td>
                    </tr>
                </table>
            </td>
          </tr>
        </table>
    </div>
    <span class="frmbar" style="margin:0 11px;"></span><span class="frmbar" style="margin:0 12px;"></span>
</div>

<div class="frmstatic" style="display:block; margin-top:10px;">
<form id="form1" runat="server">
<span class="frmbar" style="margin:0 12px;"></span><span class="frmbar" style="margin:0 11px;"></span>
<div class="controls">
          
           <table width="100%"  border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#ecf5ff">

            <tr>
                <td width="145" align="right" nowrap bgcolor="#F4FBFF">一键切换模板:</td>
                <td width="1040" align="left" bgcolor="#F4FBFF">
                    <asp:Repeater ID="rptTemplet" runat="server">
                        <HeaderTemplate>
                         <ul id="tmpul">
                        </HeaderTemplate>
                        <ItemTemplate>
                          <li title="<%#Container.DataItem.ToString()%>" style=" cursor:pointer;">
                             <img src="/templets/<%#Container.DataItem.ToString()%>/default.jpg" width="180px" height="230px" />
                             <br />
                             <%#(Container.DataItem.ToString().StartsWith("old_")?Container.DataItem.ToString()+"(弃用)":Container.DataItem.ToString())%>
                          </li>
                        </ItemTemplate>
                        <FooterTemplate>
                         </ul>
                        </FooterTemplate>
                    </asp:Repeater>
                </td>
            </tr>
         </table>

           <asp:HiddenField ID="hidTempletRoot" runat="server" Value="templets" />
         
</div>
<span class="frmbar" style="margin:0 11px;"></span><span class="frmbar" style="margin:0 12px;"></span>
</form>
</div>

</body>
</html>